package reno.market.mainmarket.rivenmarket.dao;

import org.hibernate.Session;
import org.hibernate.query.NativeQuery;
import org.springframework.stereotype.Repository;
import reno.market.mainmarket.common.HibernateUtils;
import reno.market.mainmarket.rivenmarket.entity.RivenModEO;

import java.util.List;

@Repository
public class RivenMarketDao {

    public List<RivenModEO> queryWeaponInfo(String weapon) {
        String stringBuffer = "select * from RivenMod a where a.weaponCn like '%WEAPON%' order by a.weaponCn";
        Session session = HibernateUtils.getSession();
        NativeQuery<RivenModEO> query = session.createNativeQuery(stringBuffer.replace("WEAPON", weapon), RivenModEO.class);
        List<RivenModEO> rivenModEOList = query.getResultList();
        session.close();
        return rivenModEOList;
    }

}
